package cn.iocoder.yudao.module.wengfu.dal.mysql.base;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wengfu.dal.dataobject.base.SampleBaseInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wengfu.controller.admin.base.vo.*;

/**
 * 样品基础信息 Mapper
 *
 * @author yzs
 */
@Mapper
public interface SampleBaseInfoMapper extends BaseMapperX<SampleBaseInfoDO> {

    default PageResult<SampleBaseInfoDO> selectPage(SampleBaseInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SampleBaseInfoDO>()
                .eqIfPresent(SampleBaseInfoDO::getSampleId, reqVO.getSampleId())
                .eqIfPresent(SampleBaseInfoDO::getTestId, reqVO.getTestId())
                .eqIfPresent(SampleBaseInfoDO::getSampleType, reqVO.getSampleType())
                .likeIfPresent(SampleBaseInfoDO::getSampleName, reqVO.getSampleName())
                .betweenIfPresent(SampleBaseInfoDO::getSampleTime, reqVO.getSampleTime())
                .eqIfPresent(SampleBaseInfoDO::getMiningUnit, reqVO.getMiningUnit())
                .eqIfPresent(SampleBaseInfoDO::getMiningLocation, reqVO.getMiningLocation())
                .eqIfPresent(SampleBaseInfoDO::getReceivingLocation, reqVO.getReceivingLocation())
                .eqIfPresent(SampleBaseInfoDO::getSamplingLocation, reqVO.getSamplingLocation())
                .eqIfPresent(SampleBaseInfoDO::getOreType, reqVO.getOreType())
                .eqIfPresent(SampleBaseInfoDO::getOreProperty, reqVO.getOreProperty())
                .orderByDesc(SampleBaseInfoDO::getId));
    }

}
